package com.cv.platform.dal.mapper.comment;

import com.cv.framework.common.pojo.PageResult;
import com.cv.framework.mybatis.core.mapper.BaseMapperX;
import com.cv.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.cv.platform.controller.platform.comment.vo.reply.CvCommentReplyReqVO;
import com.cv.platform.controller.platform.comment.vo.reply.CvCommentReplyRespVO;
import com.cv.platform.dal.dataobject.comment.CvCommentReplyDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 视频评论回复数据层
 *
 * @author Charles_XDXD
 */
@Mapper
public interface CvCommentReplyMapper extends BaseMapperX<CvCommentReplyDO> {

    default PageResult<CvCommentReplyRespVO> selectPage(CvCommentReplyReqVO reqVO) {
        return selectJoinPage(reqVO, CvCommentReplyRespVO.class, new MPJLambdaWrapperX<CvCommentReplyDO>()
                .selectAll(CvCommentReplyDO.class)
                .eq(CvCommentReplyDO::getCommentId, reqVO.getCommentId())
                .selectAs(CvCommentReplyDO::getReplyUserId, CvCommentReplyRespVO::getUserId)
                .orderByDesc(CvCommentReplyDO::getCreateTime)
        );
    }

}
